<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');
?>

<h1>Delete Subject</h1>

<?php

//get num_rows currently in subjects table
$subject_id = $_GET['id'];

$get_sname = "SELECT * FROM course_subjects WHERE id='$subject_id'";
$result_sname = mysql_query($get_sname);
$subject_name = mysql_result($result_sname,0,"subject_title");

$query = "DELETE FROM course_subjects WHERE id='$subject_id'";
$result = mysql_query($query);

if ($result)
{
	echo "<b>$subject_name</b> has been successfully deleted!";
	echo "<br />";
}
else
{
	echo "<b>$subject_name</b> was NOT able to be deleted at this time!";
	echo "<br />";
}

//close
mysql_close();

?>

<p>
	<a href="index.php">&lt;&lt; Back to Subjects Portal</a><br />
</p>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>